﻿<UserControl x:Class="Starehe.Views.NewStudent"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:helper="clr-namespace:Starehe;assembly=Helper"
      xmlns:Controls="clr-namespace:Helper.Controls;assembly=Helper"
      Name="page"
      mc:Ignorable="d" Background="White"
      d:DesignHeight="900" d:DesignWidth="794">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Helper;component/Converters/Converters.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <ScrollViewer VerticalScrollBarVisibility="Visible">
        <Grid Name="mnGrid" Validation.ErrorTemplate="{x:Null}" MinHeight="800">
            <Grid.BindingGroup>
                <BindingGroup ValidatesOnNotifyDataError="True"/>
            </Grid.BindingGroup>
            <TextBlock HorizontalAlignment="Left" Margin="20,20,0,0" Style="{DynamicResource Title}"  Text="Student Registration" VerticalAlignment="Top"/>
            <TextBox HorizontalAlignment="Left" Margin="120,80,0,0" Text="{Binding NewStudent.FirstName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                 VerticalAlignment="Top" Width="200" />

            <TextBox HorizontalAlignment="Left" Margin="330,80,0,0" Text="{Binding NewStudent.MiddleName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" 
                 VerticalAlignment="Top" Width="200" />
            <TextBox HorizontalAlignment="Left" Margin="540,80,0,0" Text="{Binding NewStudent.LastName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                 VerticalAlignment="Top" Width="200" />
            <DatePicker  HorizontalAlignment="Left" Margin="120,125,0,0" Name="dtDOB" VerticalAlignment="Top" Width="200"
                    SelectedDateFormat="Long"  
                    SelectedDate="{Binding NewStudent.DateOfBirth,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            <DatePicker Height="25" HorizontalAlignment="Left" Margin="120,170,0,0" VerticalAlignment="Top" Width="200" 
                    SelectedDate="{Binding NewStudent.DateOfAdmission,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                    SelectedDateFormat="Long"/>
            <TextBox HorizontalAlignment="Left" Margin="120,215,0,0" VerticalAlignment="Top" Width="280"  
                 Text="{Binding NewStudent.NameOfGuardian,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            <TextBox HorizontalAlignment="Left" Margin="120,260,0,0" VerticalAlignment="Top" Width="200"
                 Text="{Binding NewStudent.GuardianPhoneNo,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            <TextBox Margin="120,305,0,0" Name="txtOtherPhone" VerticalAlignment="Top" HorizontalAlignment="Left" Width="280"  
                 Text="{Binding NewStudent.Email,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
            <TextBox HorizontalAlignment="Left" Margin="120,350,0,0" VerticalAlignment="Top" Width="200"  
                 Text="{Binding NewStudent.Address,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            <TextBox HorizontalAlignment="Left" Margin="120,395,0,0" VerticalAlignment="Top" Width="200"  
                 Text="{Binding NewStudent.City,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
            <TextBox HorizontalAlignment="Left" Margin="120,440,0,0" VerticalAlignment="Top" Width="200"
                 Text="{Binding NewStudent.PostalCode,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            <TextBlock Text="New Class" HorizontalAlignment="Left" Margin="27,485,0,0" VerticalAlignment="Top" />
            <ComboBox HorizontalAlignment="Left" Margin="120,485,0,0" 
        	DisplayMemberPath="NameOfClass" SelectedValuePath="ClassID" VerticalAlignment="Top" Width="200"
        	ItemsSource="{Binding AllClasses}"        	
        	SelectedValue="{Binding NewStudent.ClassID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" 
                      ToolTip="Select the class that the student is assigned to."/>
            <TextBlock  HorizontalAlignment="Left" Margin="414,109,0,0" Name="textBlock1" Text="(First Name - Middle Name - Last Name)" VerticalAlignment="Top" />
            <TextBlock  HorizontalAlignment="Left" Margin="25,80,0,0" Name="textBlock3" Text="Name of Student" VerticalAlignment="Top" />
            <TextBlock  HorizontalAlignment="Left" Margin="25,125,0,0" Name="textBlock4" Text="Date of Birth" VerticalAlignment="Top" />

            <TextBlock  HorizontalAlignment="Left" Margin="27,170,0,0" Name="textBlock5" Text="Admission Date" VerticalAlignment="Top" />
            <TextBlock  HorizontalAlignment="Left" Margin="25,215,0,0" Name="textBlock6" Text="Guadian Name" VerticalAlignment="Top" />
            <TextBlock  HorizontalAlignment="Left" Margin="27,260,0,0" Name="textBlock8" Text="Phone No" VerticalAlignment="Top" />

            <TextBlock  HorizontalAlignment="Left" Margin="27,305,0,0" Name="textBlock9" Text="Email" VerticalAlignment="Top" />
            <TextBlock  HorizontalAlignment="Left" Margin="27,350,0,0" Name="textBlock10" Text="Address" VerticalAlignment="Top" />

            <TextBlock HorizontalAlignment="Left" Margin="27,395,0,0" TextWrapping="Wrap" Text="City" VerticalAlignment="Top"/>

            <TextBlock HorizontalAlignment="Left" Margin="27,440,0,0" TextWrapping="Wrap" Text="Postal Code" VerticalAlignment="Top"/>
            <TextBlock HorizontalAlignment="Left" Margin="20,585,0,0" TextWrapping="Wrap" LineHeight="10" VerticalAlignment="Top" Text="Prev. Institution Attended" Height="32" Width="86" />
            <TextBox  HorizontalAlignment="Left" Margin="120,585,0,0" 
                      Text="{Binding NewStudent.PrevSchool, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top"  Width="200" 
        	ToolTip="If transfer student enter name of Previous School"/>
            
            <TextBlock HorizontalAlignment="Left" Margin="20,539,0,0" Style="{DynamicResource ResourceKey=Title0}" Text="Optional" 
        	VerticalAlignment="Top"/>
            <TextBlock Text="Current Dormitory" HorizontalAlignment="Left" Margin="18,630,0,0" x:Name="label5" VerticalAlignment="Top" />
            <ComboBox DisplayMemberPath="NameOfDormitory"  HorizontalAlignment="Left" Margin="120,630,0,0"
        	ItemsSource="{Binding AllDorms}"
        	SelectedValuePath="DormitoryID" 
        	SelectedValue="{Binding NewStudent.DormitoryID, Mode=TwoWay}"
        	VerticalAlignment="Top" Width="200" />
            <TextBlock HorizontalAlignment="Left" Margin="325,630,0,0" 
        	VerticalAlignment="Top" ><Hyperlink Command="{Binding ClearDormCommand}"><Run Text="Clear"/></Hyperlink></TextBlock>
            <TextBlock Text="Bed No." HorizontalAlignment="Left" Margin="18,675,0,0" VerticalAlignment="Top" />
            <TextBox HorizontalAlignment="Left" 
        	Margin="120,675,0,0" TabIndex="2"  VerticalAlignment="Top" Width="200" 
        	Text="{Binding NewStudent.BedNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
            <Border BorderBrush="{DynamicResource TitleBackgroundBrush}" BorderThickness="1" Margin="425,230,10,0" Height="300" VerticalAlignment="Top">
                <Image Source="{Binding NewStudent.SPhoto, Converter={StaticResource StreamToImageSourceConverter}, Mode=OneWay}" Stretch="Uniform"/>
            </Border>
            <TextBlock HorizontalAlignment="Left" Margin="425,200,0,0" Style="{DynamicResource Title0}" Text="Photo" VerticalAlignment="Top"/>
            <TextBlock  HorizontalAlignment="Right" Margin="0,208,10,0" 
        	VerticalAlignment="Top" ><Hyperlink Command="{Binding ClearImageCommand}"><Run Text="Clear"/></Hyperlink></TextBlock>
            <Button Content="_Browse" HorizontalAlignment="Right" Margin="0,535,10,0" Width="105" Command="{Binding BrowseCommand}" Height="26" VerticalAlignment="Top" />
            <Button Content="_Save" HorizontalAlignment="Right" Margin="0,0,10,9" VerticalAlignment="Bottom" Width="75" 
                Command="{Binding SaveCommand}"/>
        </Grid>
    </ScrollViewer>
</UserControl>
